3.38 \(\int \sin ^2(e+f x) (a+b \tan ^2(e+f x)) \, dx\)

Optimal. Leaf size=46 \[ -\frac{(a-b) \sin (e+f x) \cos (e+f x)}{2 f}+\frac{1}{2} x (a-3 b)+\frac{b \tan (e+f x)}{f} \]

[Out]

((a - 3*b)*x)/2 - ((a - b)*Cos[e + f*x]*Sin[e + f*x])/(2*f) + (b*Tan[e + f*x])/f

________________________________________________________________________________________

Rubi [A]  time = 0.047587, antiderivative size = 46, normalized size of antiderivative = 1., number of steps used = 4, number of rules used = 4, integrand size = 21, \(\frac{\text{number of rules}}{\text{integrand size}}\) = 0.19, Rules used = {3663, 455, 388, 203} \[ -\frac{(a-b) \sin (e+f x) \cos (e+f x)}{2 f}+\frac{1}{2} x (a-3 b)+\frac{b \tan (e+f x)}{f} \]

Antiderivative was successfully verified.

[In]

Int[Sin[e + f*x]^2*(a + b*Tan[e + f*x]^2),x]

[Out]

((a - 3*b)*x)/2 - ((a - b)*Cos[e + f*x]*Sin[e + f*x])/(2*f) + (b*Tan[e + f*x])/f

Rule 3663

Int[sin[(e_.) + (f_.)*(x_)]^(m_)*((a_) + (b_.)*((c_.)*tan[(e_.) + (f_.)*(x_)])^(n_))^(p_.), x_Symbol] :> With[
{ff = FreeFactors[Tan[e + f*x], x]}, Dist[(c*ff^(m + 1))/f, Subst[Int[(x^m*(a + b*(ff*x)^n)^p)/(c^2 + ff^2*x^2
)^(m/2 + 1), x], x, (c*Tan[e + f*x])/ff], x]] /; FreeQ[{a, b, c, e, f, n, p}, x] && IntegerQ[m/2]

Rule 455

Int[(x_)^(m_)*((a_) + (b_.)*(x_)^2)^(p_)*((c_) + (d_.)*(x_)^2), x_Symbol] :> Simp[((-a)^(m/2 - 1)*(b*c - a*d)*
x*(a + b*x^2)^(p + 1))/(2*b^(m/2 + 1)*(p + 1)), x] + Dist[1/(2*b^(m/2 + 1)*(p + 1)), Int[(a + b*x^2)^(p + 1)*E
xpandToSum[2*b*(p + 1)*x^2*Together[(b^(m/2)*x^(m - 2)*(c + d*x^2) - (-a)^(m/2 - 1)*(b*c - a*d))/(a + b*x^2)]
- (-a)^(m/2 - 1)*(b*c - a*d), x], x], x] /; FreeQ[{a, b, c, d}, x] && NeQ[b*c - a*d, 0] && LtQ[p, -1] && IGtQ[
m/2, 0] && (IntegerQ[p] || EqQ[m + 2*p + 1, 0])

Rule 388

Int[((a_) + (b_.)*(x_)^(n_))^(p_)*((c_) + (d_.)*(x_)^(n_)), x_Symbol] :> Simp[(d*x*(a + b*x^n)^(p + 1))/(b*(n*
(p + 1) + 1)), x] - Dist[(a*d - b*c*(n*(p + 1) + 1))/(b*(n*(p + 1) + 1)), Int[(a + b*x^n)^p, x], x] /; FreeQ[{
a, b, c, d, n}, x] && NeQ[b*c - a*d, 0] && NeQ[n*(p + 1) + 1, 0]

Rule 203

Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(1*ArcTan[(Rt[b, 2]*x)/Rt[a, 2]])/(Rt[a, 2]*Rt[b, 2]), x] /;
 FreeQ[{a, b}, x] && PosQ[a/b] && (GtQ[a, 0] || GtQ[b, 0])

Rubi steps

\begin{align*} \int \sin ^2(e+f x) \left (a+b \tan ^2(e+f x)\right ) \, dx &=\frac{\operatorname{Subst}\left (\int \frac{x^2 \left (a+b x^2\right )}{\left (1+x^2\right )^2} \, dx,x,\tan (e+f x)\right )}{f}\\ &=-\frac{(a-b) \cos (e+f x) \sin (e+f x)}{2 f}-\frac{\operatorname{Subst}\left (\int \frac{-a+b-2 b x^2}{1+x^2} \, dx,x,\tan (e+f x)\right )}{2 f}\\ &=-\frac{(a-b) \cos (e+f x) \sin (e+f x)}{2 f}+\frac{b \tan (e+f x)}{f}+\frac{(a-3 b) \operatorname{Subst}\left (\int \frac{1}{1+x^2} \, dx,x,\tan (e+f x)\right )}{2 f}\\ &=\frac{1}{2} (a-3 b) x-\frac{(a-b) \cos (e+f x) \sin (e+f x)}{2 f}+\frac{b \tan (e+f x)}{f}\\ \end{align*}

Mathematica [A]  time = 0.216948, size = 43, normalized size = 0.93 \[ \frac{2 (a-3 b) (e+f x)+(b-a) \sin (2 (e+f x))+4 b \tan (e+f x)}{4 f} \]

Antiderivative was successfully verified.

[In]

Integrate[Sin[e + f*x]^2*(a + b*Tan[e + f*x]^2),x]

[Out]

(2*(a - 3*b)*(e + f*x) + (-a + b)*Sin[2*(e + f*x)] + 4*b*Tan[e + f*x])/(4*f)

________________________________________________________________________________________

Maple [A]  time = 0.033, size = 81, normalized size = 1.8 \begin{align*}{\frac{1}{f} \left ( a \left ( -{\frac{\cos \left ( fx+e \right ) \sin \left ( fx+e \right ) }{2}}+{\frac{fx}{2}}+{\frac{e}{2}} \right ) +b \left ({\frac{ \left ( \sin \left ( fx+e \right ) \right ) ^{5}}{\cos \left ( fx+e \right ) }}+ \left ( \left ( \sin \left ( fx+e \right ) \right ) ^{3}+{\frac{3\,\sin \left ( fx+e \right ) }{2}} \right ) \cos \left ( fx+e \right ) -{\frac{3\,fx}{2}}-{\frac{3\,e}{2}} \right ) \right ) } \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(sin(f*x+e)^2*(a+b*tan(f*x+e)^2),x)

[Out]

1/f*(a*(-1/2*cos(f*x+e)*sin(f*x+e)+1/2*f*x+1/2*e)+b*(sin(f*x+e)^5/cos(f*x+e)+(sin(f*x+e)^3+3/2*sin(f*x+e))*cos
(f*x+e)-3/2*f*x-3/2*e))

________________________________________________________________________________________

Maxima [A]  time = 1.54547, size = 69, normalized size = 1.5 \begin{align*} \frac{{\left (f x + e\right )}{\left (a - 3 \, b\right )} + 2 \, b \tan \left (f x + e\right ) - \frac{{\left (a - b\right )} \tan \left (f x + e\right )}{\tan \left (f x + e\right )^{2} + 1}}{2 \, f} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(sin(f*x+e)^2*(a+b*tan(f*x+e)^2),x, algorithm="maxima")

[Out]

1/2*((f*x + e)*(a - 3*b) + 2*b*tan(f*x + e) - (a - b)*tan(f*x + e)/(tan(f*x + e)^2 + 1))/f

________________________________________________________________________________________

Fricas [A]  time = 1.86203, size = 131, normalized size = 2.85 \begin{align*} \frac{{\left (a - 3 \, b\right )} f x \cos \left (f x + e\right ) -{\left ({\left (a - b\right )} \cos \left (f x + e\right )^{2} - 2 \, b\right )} \sin \left (f x + e\right )}{2 \, f \cos \left (f x + e\right )} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(sin(f*x+e)^2*(a+b*tan(f*x+e)^2),x, algorithm="fricas")

[Out]

1/2*((a - 3*b)*f*x*cos(f*x + e) - ((a - b)*cos(f*x + e)^2 - 2*b)*sin(f*x + e))/(f*cos(f*x + e))

________________________________________________________________________________________

Sympy [F]  time = 0., size = 0, normalized size = 0. \begin{align*} \int \left (a + b \tan ^{2}{\left (e + f x \right )}\right ) \sin ^{2}{\left (e + f x \right )}\, dx \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(sin(f*x+e)**2*(a+b*tan(f*x+e)**2),x)

[Out]

Integral((a + b*tan(e + f*x)**2)*sin(e + f*x)**2, x)

________________________________________________________________________________________

Giac [B]  time = 1.55597, size = 533, normalized size = 11.59 \begin{align*} \frac{a f x \tan \left (f x\right )^{3} \tan \left (e\right )^{3} - 3 \, b f x \tan \left (f x\right )^{3} \tan \left (e\right )^{3} + a f x \tan \left (f x\right )^{3} \tan \left (e\right ) - 3 \, b f x \tan \left (f x\right )^{3} \tan \left (e\right ) - a f x \tan \left (f x\right )^{2} \tan \left (e\right )^{2} + 3 \, b f x \tan \left (f x\right )^{2} \tan \left (e\right )^{2} + a f x \tan \left (f x\right ) \tan \left (e\right )^{3} - 3 \, b f x \tan \left (f x\right ) \tan \left (e\right )^{3} + a \tan \left (f x\right )^{3} \tan \left (e\right )^{2} - 3 \, b \tan \left (f x\right )^{3} \tan \left (e\right )^{2} + a \tan \left (f x\right )^{2} \tan \left (e\right )^{3} - 3 \, b \tan \left (f x\right )^{2} \tan \left (e\right )^{3} - a f x \tan \left (f x\right )^{2} + 3 \, b f x \tan \left (f x\right )^{2} + a f x \tan \left (f x\right ) \tan \left (e\right ) - 3 \, b f x \tan \left (f x\right ) \tan \left (e\right ) - a f x \tan \left (e\right )^{2} + 3 \, b f x \tan \left (e\right )^{2} - 2 \, b \tan \left (f x\right )^{3} - 2 \, a \tan \left (f x\right )^{2} \tan \left (e\right ) - 2 \, a \tan \left (f x\right ) \tan \left (e\right )^{2} - 2 \, b \tan \left (e\right )^{3} - a f x + 3 \, b f x + a \tan \left (f x\right ) - 3 \, b \tan \left (f x\right ) + a \tan \left (e\right ) - 3 \, b \tan \left (e\right )}{2 \,{\left (f \tan \left (f x\right )^{3} \tan \left (e\right )^{3} + f \tan \left (f x\right )^{3} \tan \left (e\right ) - f \tan \left (f x\right )^{2} \tan \left (e\right )^{2} + f \tan \left (f x\right ) \tan \left (e\right )^{3} - f \tan \left (f x\right )^{2} + f \tan \left (f x\right ) \tan \left (e\right ) - f \tan \left (e\right )^{2} - f\right )}} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(sin(f*x+e)^2*(a+b*tan(f*x+e)^2),x, algorithm="giac")

[Out]

1/2*(a*f*x*tan(f*x)^3*tan(e)^3 - 3*b*f*x*tan(f*x)^3*tan(e)^3 + a*f*x*tan(f*x)^3*tan(e) - 3*b*f*x*tan(f*x)^3*ta
n(e) - a*f*x*tan(f*x)^2*tan(e)^2 + 3*b*f*x*tan(f*x)^2*tan(e)^2 + a*f*x*tan(f*x)*tan(e)^3 - 3*b*f*x*tan(f*x)*ta
n(e)^3 + a*tan(f*x)^3*tan(e)^2 - 3*b*tan(f*x)^3*tan(e)^2 + a*tan(f*x)^2*tan(e)^3 - 3*b*tan(f*x)^2*tan(e)^3 - a
*f*x*tan(f*x)^2 + 3*b*f*x*tan(f*x)^2 + a*f*x*tan(f*x)*tan(e) - 3*b*f*x*tan(f*x)*tan(e) - a*f*x*tan(e)^2 + 3*b*
f*x*tan(e)^2 - 2*b*tan(f*x)^3 - 2*a*tan(f*x)^2*tan(e) - 2*a*tan(f*x)*tan(e)^2 - 2*b*tan(e)^3 - a*f*x + 3*b*f*x
 + a*tan(f*x) - 3*b*tan(f*x) + a*tan(e) - 3*b*tan(e))/(f*tan(f*x)^3*tan(e)^3 + f*tan(f*x)^3*tan(e) - f*tan(f*x
)^2*tan(e)^2 + f*tan(f*x)*tan(e)^3 - f*tan(f*x)^2 + f*tan(f*x)*tan(e) - f*tan(e)^2 - f)